#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>


QT_BEGIN_NAMESPACE
namespace Ui { class MyWidget; }
QT_END_NAMESPACE

class MyWidget : public QWidget
{
    Q_OBJECT

public:
    MyWidget(QWidget *parent = nullptr);
    ~MyWidget();

protected:
    // 按键按下
    void keyPressEvent(QKeyEvent *ev) override;

    // 按键松开
    void keyReleaseEvent(QKeyEvent *ev) override;

    // 计时器事件
    void timerEvent(QTimerEvent *ev) override;

    // 窗口的鼠标按下事件
    void mousePressEvent(QMouseEvent *ev) override;

    // 窗口关闭事件
    void closeEvent(QCloseEvent *ev) override;


private:
    Ui::MyWidget *ui;
    int timerId;        // 计时器1
    int timerId2;       // 计时器2
};
#endif // MYWIDGET_H
